home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / magicwb / czesc_2 / mwb_dopus / arexx / winswap.dopus5 < prev    next >
Text File  |  1995-07-16  |  3KB  |  83 lines

  1. /* WinSwap v1.00 [16-Jul-1995] for Directory Opus 5.
  2.    By Leo Davidson ("Nudel", Pot-Noodle/Gods'Gift Utilities)
  3.  
  4.    NOTE: This script _requires_ DOpus v5.11 or above.
  5.  
  6.    This script will swap around your source and destination listers,
  7.    like the old swap command in DOpus4.
  8.  
  9.    If you specify the "PathOnly" option, each lister will read the other's
  10.    path but their window positions will remaind the same. Otherwise, the
  11.    two listers physically swap window positions. For the user the end
  12.    result is identical. However, if the two windows are different sizes
  13.    swapping the windows may be slower than swapping the paths, while if
  14.    the two windows are the same size, swapping the paths may be slower.
  15.    Of course, it all depends on the speed of your machine and the size
  16.    of the directories, so experiment and see which one you prefer.
  17.  
  18.    Obviously, in DOpus5 it is possible to simply move the two lister
  19.    windows, but somethimes this isn't desireable. For example, when they
  20.    are locked in place via the option in the pull-off menu; when you're
  21.    too lazy to move the windows; or when the two windows are positioned
  22.    such that moving them would be difficult or would make a mess.
  23.  
  24. Call as:
  25. ------------------------------------------------------------------------------
  26. ARexx    DOpus5:ARexx/WinSwap.dopus5 {Qp} [PathOnly]
  27. ------------------------------------------------------------------------------
  28. Turn off all switches.
  29. */
  30.  
  31. options results
  32. options failat 99
  33. signal on syntax;signal on ioerr        /* Error trapping */
  34. parse arg DOpusPort PathOnlyOption
  35. DOpusPort = Strip(Strip(DOpusPort,"B"," "),"B",'"')
  36. PathOnlyOption = Strip(Strip(PathOnlyOption,"B"," "),"B",'"')
  37. If DOpusPort~="" THEN Address value DOpusPort
  38. ELSE Do
  39.     Say "Not correctly called from Directory Opus 5!"
  40.     Say "Load this ARexx script into editor for more info."
  41.     EXIT
  42.     END
  43.  
  44. lister query source stem source_handle.
  45.  
  46. IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
  47.     dopus request '"You must have a SOURCE lister!" OK'
  48.     EXIT
  49.     End
  50.  
  51.  
  52. lister query dest stem dest_handle.
  53.  
  54. IF dest_handle.count = 0 | dest_handle.count = "DEST_HANDLE.COUNT" Then Do
  55.     dopus request '"You must have a DESTINATION lister!" OK'
  56.     EXIT
  57.     End
  58.  
  59.  
  60. If PathOnlyOption = "PathOnly" Then Do
  61.     lister query source_handle.0 path
  62.     source_path = RESULT
  63.     lister query dest_handle.0 path
  64.     dest_path = RESULT
  65.  
  66.     lister read source_handle.0 dest_path
  67.     lister read dest_handle.0 source_path
  68.     END
  69.  
  70.  
  71. Else Do
  72.     lister query source_handle.0 position
  73.     source_position = RESULT
  74.     lister query dest_handle.0 position
  75.     dest_position = RESULT
  76.  
  77.     lister set source_handle.0 position dest_position
  78.     lister set dest_handle.0 position source_position
  79.     END
  80.  
  81. syntax:;ioerr:                /* In case of error, jump here */
  82. EXIT
  83.